# -*- coding: utf-8 -*-
__author__ = 'gongqf'
import urllib, urllib2, re, sqlite3, cookielib, os,json
from email.Message import Message


DB_FILE = r'\web\query-illegal-car\data\car.sqlite'


def query_car_from_database():
    conn = sqlite3.connect(DB_FILE)
    conn.text_factory = str
    conn.row_factory = sqlite3.Row
    cursor = conn.cursor()
    rs = cursor.execute("SELECT * FROM car").fetchall()
    cursor.close()
    conn.close()
    return rs

a=json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')
print a[1]['bar']

print DB_FILE
car = query_car_from_database()
for c in car:
    print c['carowner']